package thread;

/**
 * @Author Janson
 * @Date 2022/2/25 10:52
 * @Version 1.0
 */
public class TestLambdaRunnalbe {
    public static void main(String[] args) {
        Runnable runnable = ()->{
            int sum = 0;
            for (int i = 0; i <100; i++) {
                System.out.println("参与求和的数字：" + i);
                System.out.println("目前求和的线程："+ Thread.currentThread().getName());

                sum += i;
            }
            System.out.println("最后的求和为：" + sum + Thread.currentThread().getName());
        };
        new Thread(runnable,"线程1").start();
        new Thread(runnable,"线程2").start();
    }
}
